package com.wcar.store.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wcar.common.entity.CarWashRecord;
import com.wcar.common.entity.StoreEvaluate;
import com.wcar.common.vo.Result;
import com.wcar.store.dao.CarWashRecordDao;
import com.wcar.store.service.CarWashRecordService;
import com.wcar.store.vo.CalendarVo;
import com.wcar.store.vo.CarWashRecordVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: four-wcar-idea
 * @description:
 * @author: 吴朝阳
 * @create: 2024-06-04 15:21
 **/
@Service
public class CarWashRecordServiceImpl implements CarWashRecordService {
    @Autowired
    private CarWashRecordDao carWashRecordDao;
    @Override
    public Result<List<CarWashRecord>> selectCarNumByUserId(Integer userId) {
        QueryWrapper<CarWashRecord> wrapper = new QueryWrapper<>();
        wrapper.eq("user_id",userId);
        List<CarWashRecord> result = carWashRecordDao.selectByCount(userId);
        return new Result<>(200,"查询服务次数成功",result);
    }
    @Override
    public Result<List<CalendarVo>> selectRecordByUserId(Integer userId, String createDate) {
        List<CalendarVo> carWashRecordVos = carWashRecordDao.selectCarLog(userId, createDate);
        if (carWashRecordVos!=null && carWashRecordVos.size()>0){
            return new Result<>(200,"查询洗车记录成功",carWashRecordVos);
        }
        return new Result<>(500,"查询洗车记录失败",null);
    }


}
